package com.github.abel533.autowired.postprocessor;

import com.github.abel533.C;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @author liuzh
 */
@Component
public class UserExt {

    private String name;

    private User user;

    private String osName;

    public UserExt(User user) {
        this.user = user;
        Assert.notNull(user);
        C.print("UserExt#constructor");
    }

    public String getName() {
        return name;
    }

    @Value("${autowired.testValue}")
    public void setName(String name) {
        this.name = name;
        C.print("UserExt@Value(\"${autowired.testValue}\")");
    }

    public User getUser() {
        return user;
    }

    public String getOsName() {
        return osName;
    }

    @Value("#{systemProperties['os.name']}")
    public void setOsName(String osName) {
        this.osName = osName;
        C.print("UserExt@Value(\"#{systemProperties['os.name']}\")");
    }

}
